<?php exit?>
<!--{include file="header.php"}-->
<script type="text/javascript" src="core/scripts/jquery.lightbox.js"></script>
<link rel="stylesheet" type="text/css" href="core/styles/jquery.lightbox.css" />
<div class="layout">
	<!--{if $article}-->
	<form action="?action=content&do=article_delete" method="post" id="article_form">
	<table cellspacing="0" cellpadding="0" width="100%" class="table">
		<thead>
		<tr>
		<th align="center" width="5%">&nbsp;</th>
		<th align="left"  width="68%">标题</td>
 		<th  width="15%">发布时间</td>
		<th  width="12%" nowrap>操作</td>
		</tr>
		</thead>
		<tbody>
		<!--{foreach from=$article item=article}-->
		<tr>
		<td style="height:30px;" align="center" ><input type="checkbox" class="checkbox" name="article_id[]" value="<!--{$article.id}-->" /></td>
		<td>
		<!--{if $article.category_name}-->
		<a href="?action=content&do=article&category_id=<!--{$article.category_id}-->" style="font-weight:bold;color:#F5D58D">[<!--{$article.category_name}-->]</a>&nbsp;
		<!--{/if}-->
		<a href="?action=content&do=article_edit&article_id=<!--{$article.id}-->"><!--{$article.title}--></a>

		<!--{if $article.comment_count}-->
		(<a href="?action=content&do=comment&article_id=<!--{$article.id}-->" style="color:#B5D53B">评论<!--{$article.comment_count}-->条</a>)
		<!--{/if}-->

		<!--{if $article.is_best==1}-->
			<b style="color:#B5D53B">[推荐]</b>
		<!--{/if}-->
		<!--{if $article.is_comment==0}-->
			<b style="color:#FE8217">[评论已关闭]</b>
		<!--{/if}-->

		<!--{if $article.image}-->
			<a href="<!--{$article.image}-->" target="_blank" class="lightbox"><img src="<!--{$article.image}-->" alt="" align="absmiddle" style="width:22px;height:22px;border:1px solid #333;padding:1px"/></a>
		<!--{/if}-->
		</td>


		<td align="center" style="color:#666" nowrap><!--{$article.time}--></td>
		<td align="center" style="color:#666" nowrap>
		<a href="<!--{$article.url}-->" target="_blank" class="button">预览</a>
		<a href="?action=content&do=article_edit&article_id=<!--{$article.id}-->" class="button">编辑</a>
		</td>
		</tr>
		<!--{/foreach}-->
		</tbody>
		<tfoot>
		<tr>
		<td height="30" align="center"><input type="checkbox" onclick="check_all(this)" /></td>
		<td colspan="4">
		<div style="float:right;margin:8px;"><!--{include file="pager.php"}--></div>
		<a href="javascript:;" onclick="html_article()" class="button">批量生成</a> <a href="javascript:;" onclick="del()" class="button">批量删除</a>
			<input type="text" class="input" id="search_keyword" />
	<a href="javascript:Search()"  class="button">搜索</a>
		</td>
		</tr>
		</tfoot>
	</table>
	</form>
	<!--{else}-->
	<div style="line-height:50px;text-align:center;">暂无数据</div>
	<!--{/if}-->

</div>
<div style="text-align:right">
<!--<a class="button" href="?action=content&do=clear" onclick="return confirm('确定要操作吗？')">清理全部数据</a>-->
<a class="button" href="?action=content&do=article_add<!--{if $template.get.category_id}-->&category_id=<!--{$template.get.category_id}--><!--{/if}-->">发布文章</a>
</div>
<script type="text/javascript">
$(function(){
	$('.lightbox').lightBox();
});
function Search(){
var keyword=$("#search_keyword").val();
	if($.trim(keyword)==''){
		alert('关键字不能为空');
		$("#search_keyword").focus();
		return;
	}
	keyword=keyword.replace(/\'/gi,"");
	keyword=keyword.replace(/\"/gi,"");
	keyword=keyword.replace(/\?/gi,"");
	keyword=keyword.replace(/\%/gi,"");
	keyword=keyword.replace(/\./gi,"");
	keyword=keyword.replace(/\*/gi,"");
	window.location.href="?action=content&do=article<!--{if $template.get.category_id}-->&category_id=<!--{$template.get.category_id}--><!--{/if}-->&keyword="+encodeURI(keyword);
}
function del(){
	var status=false;
	$('.checkbox').each(function(){
		if($(this).attr('checked')){
			status=true;
		}
	});
	if(!status){
		alert('至少选择一项');
		return false;
	}
	$('#article_form').attr('action','?action=content&do=article_delete');
	$('#article_form').submit();
}
function html_article(){
	var status=false;
	$('.checkbox').each(function(){
		if($(this).attr('checked')){
			status=true;
		}
	});
	if(!status){
		alert('至少选择一项');
		return false;
	}
	if(confirm('确定要操作吗？')){
		$('#article_form').attr('action','?action=content&do=html');
		$('#article_form').submit();
	}
}
</script>